package cn.zy.dome.server;

import cn.zy.amyan.client.AyClient;
import cn.zy.amyan.client.factory.BeanFactory;
import cn.zy.amyan.client.future.AyFutureResponse;
import cn.zy.amyan.client.util.AyClientUtil;
import cn.zy.amyan.core.data.ProductInfo;
import cn.zy.amyan.server.AyServer;
import cn.zy.amyan.server.interfaces.IAyServer;

import java.util.concurrent.ExecutionException;

/**
 * @author 子言
 * @date 2024/5/5 下午 17:37
 */
public class ProducerApplication {

	// 生产者使用
	public static void main(String[] args) {
		// 作为服务提供者（服务端）启动
		Thread thread = new Thread(()->{
			AyServer.start("127.0.0.1", 7788);
		});
		thread.start();
		
		// 可通过配置信息获取
		ProductInfo productInfo = new ProductInfo();
		productInfo.setServerName("dome-product");
		productInfo.setHost("127.0.0.1");
		productInfo.setPort(7788);
		// 向注册中心注册
		boolean register = AyClientUtil.register(productInfo);
		System.out.println("register = " + register);
	}
	
}
